<template>
  <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
    <a class="navbar-brand" href="/">Navbar</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarsExampleDefault">
      <ul class="navbar-nav mr-auto">
      	<li class="nav-item">
          <a class="nav-link" href="/home">Home </a>
        </li>
        <li class="nav-item" v-if="user && user.id">
          <a class="nav-link" href="/users/loginOut">注销</a>
        </li>
        <li class="nav-item" v-if="!user || !user.id">
          <a class="nav-link" href="/users/login">登录</a>
        </li>  
        <li class="nav-item">
          <a class="nav-link" href="/publish/toAdd">发表</a>
        </li>
      </ul>
      <form class="form-inline my-2 my-lg-0">
        <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
      </form>
    </div>
  </nav>
</template>

<script>
export default {
  data () {
    return {
      user:'',
      test: 'Hello fabiao!'
    }
  }
}
</script>

